import 'package:flutter_jd/pages/about/view.dart';
import 'package:flutter_jd/pages/blog/blog/view.dart';
import 'package:flutter_jd/pages/blog/detail/view.dart';
import 'package:flutter_jd/pages/feedback/view.dart';
import 'package:flutter_jd/pages/goods/comment/view.dart';
import 'package:flutter_jd/pages/user/address/manage/view.dart';
import 'package:flutter_jd/pages/user/user_info/view.dart';
import 'package:flutter_jd/routes/router_auth.dart';
import 'package:flutter_jd/routes/routing_constants.dart';
import 'package:flutter_jd/pages/agreement/privacy.dart';
import 'package:flutter_jd/pages/goods/detail/view.dart';
import 'package:flutter_jd/pages/launch/view.dart';
import 'package:flutter_jd/pages/login/view.dart';
import 'package:flutter_jd/pages/message/view.dart';
import 'package:flutter_jd/pages/order/view.dart';
import 'package:flutter_jd/pages/search/view.dart';
import 'package:flutter_jd/pages/setting/view.dart';
import 'package:flutter_jd/pages/tabbar/cart/cart.dart';
import 'package:flutter_jd/pages/tabbar/category/view.dart';
import 'package:flutter_jd/pages/tabbar/find/view.dart';
import 'package:flutter_jd/pages/tabbar/home/view.dart';
import 'package:flutter_jd/pages/tabbar/my/view.dart';
import 'package:flutter_jd/ui/widgets/preview/picture_view.dart';
import 'package:get/get.dart';

/// 路由管理
/// 如何拦截要登录的页面？
/// 只需要在 GetPage 里面加上 middlewares: [RouteAuthMiddleware(priority: 1),] 即可
abstract class AppPages {
  static final pages = [
    GetPage(
      name: LaunchRoute,
      page: () => LaunchPage(),
      title: '启动页',
    ),
    GetPage(
      name: HomeRoute,
      page: () => Home(),
      title: '首页',
    ),
    GetPage(
      name: CategoryRoute,
      page: () => Category(
        arguments: {},
      ),
      title: '分类',
    ),
    GetPage(
      name: FindRoute,
      page: () => Find(),
      title: '发现',
    ),
    GetPage(
      name: CartRoute,
      page: () => Cart(),
      title: '购物车',
    ),
    GetPage(
      name: MyRoute,
      page: () => My(),
      title: '我的',
      middlewares: [
        RouteAuthMiddleware(priority: 1),
      ],
    ),
    GetPage(
      name: SettingRoute,
      page: () => SettingPage(),
      title: '设置',
    ),
    GetPage(
      name: SearchRoute,
      page: () => SearchPage(),
      title: '搜索',
    ),
    GetPage(
      name: GoodsDetailRoute,
      page: () => GoodsDetail(arguments: {}),
      title: '商品详情',
    ),
    GetPage(
      name: GoodsCommentRoute,
      page: () => GoodsComment(),
      title: '商品评价',
    ),
    GetPage(
      name: OrderRoute,
      page: () => Order(),
      title: '订单',
      middlewares: [
        RouteAuthMiddleware(priority: 1),
      ],
    ),
    GetPage(
      name: PrivacyRoute,
      page: () => Privacy(),
      title: '隐私政策',
    ),
    GetPage(
      name: BlogRoute,
      page: () => Blog(),
      title: '博客',
    ),
    GetPage(
      name: BlogDetailRoute,
      page: () => BlogDetail(),
      title: '博客',
    ),
    GetPage(
      name: MessageRoute,
      page: () => Message(),
      title: '消息',
      middlewares: [
        RouteAuthMiddleware(priority: 1),
      ],
    ),
    GetPage(
      name: UserInfoRoute,
      page: () => UserInfo(),
      title: '个人信息',
      middlewares: [
        RouteAuthMiddleware(priority: 1),
      ],
    ),
    GetPage(
      name: AddressManageRoute,
      page: () => AddressManage(),
      title: '地址管理',
      middlewares: [
        RouteAuthMiddleware(priority: 1),
      ],
    ),
    GetPage(
      name: FeedbackRoute,
      page: () => Feedback(),
      title: '功能反馈',
      middlewares: [
        RouteAuthMiddleware(priority: 1),
      ],
    ),
    GetPage(
      name: LoginRoute,
      page: () => Login(),
      title: '登录',
      transitionDuration: Duration(milliseconds: 230),
      transition: Transition.downToUp,
      fullscreenDialog: true,
    ),
    GetPage(
      name: PictureViewRoute,
      transition: Transition.fadeIn,
      fullscreenDialog: true,
      page: () => PictureView(
        imgList: [],
      ),
      title: '图片预览',
      transitionDuration: Duration(milliseconds: 400),
      opaque: false,
    ),
    GetPage(
      name: AboutRoute,
      page: () => About(),
      title: '关于APP',
    ),
  ];
}
